How to download SEC 13F holdings data in Python

API
Data Sources
Tutorial
Python
I show how to download U.S. Securities and Exchange Commission 13F holdings data for free in Python and convert it into a panel with report date, manager, security, shares in millions, and value in millions of U.S. dollars.
Published

November 24, 2026

Updated

November 26, 2026

downloading SEC 13F holdings data in Python

The U.S. Securities and Exchange Commission (SEC) publishes free data from Forms 13F filed since 2013. An institutional investment manager with at least $100 million of U.S.-listed stocks and certain other securities under management files a Form 13F within 45 days after the end of each quarter. Form 13F contains information on the manager’s security holdings, such as market value in U.S. dollars. Short positions are excluded, as are other positions that the manager asks the SEC to keep confidential. In this post, I show how to download Form 13F data from the SEC in Python.

Downloading the data

To get the URL needed for the download, I copy the ZIP link for June to August 2026 on the SEC’s Form 13F Data Sets page. For other months, copy another ZIP link from the same page. To get several periods, you can rewrite the code as a loop over their links and join the panels with pd.concat.

Each request requires disclosing your name and contact email (SEC rules for automated access), and the maximum is 10 requests per second. One possibility, which I do, is to save my name and email in PowerShell so that if I share my notebook (which I do here), there is no need to show them; although they are not that confidential, it is good practice. To do so on Windows, run setx SEC_USER_AGENT "Your Name your@email.com" once in PowerShell. Then close Jupyter and the program you started it from, reopen both, and run the notebook from the start.

NoteCode: downloading the data
import io
import os
import zipfile

import pandas as pd
import requests

URL = ("https://www.sec.gov/files/datastandardsinnovation/data/form-13f-data-sets/"
       "01jun2026-31aug2026_form13f.zip")
HEADERS = {"User-Agent": os.environ["SEC_USER_AGENT"]}

response = requests.get(URL, headers=HEADERS, timeout=300)
response.raise_for_status()
archive = zipfile.ZipFile(io.BytesIO(response.content))
sizes = pd.Series({info.filename: info.file_size / 1e6 for info in archive.infolist()})
print("Unzipped size in MB")
print(sizes.round(1).to_string())
Unzipped size in MB
COVERPAGE.tsv              2.1
INFOTABLE.tsv            396.6
OTHERMANAGER.tsv           0.4
OTHERMANAGER2.tsv          0.3
SIGNATURE.tsv              1.3
SUBMISSION.tsv             0.7
SUMMARYPAGE.tsv            0.4
FORM13F_metadata.json      0.0
FORM13F_readme.htm         0.4

Building a panel

The tsv file “SUBMISSION” gives me the form type, the manager’s Central Index Key (CIK), the report date, and the filing date. The file “COVERPAGE” gives me the manager’s name, and the file “INFOTABLE” gives all lines of each report.

submissions = pd.read_csv(archive.open("SUBMISSION.tsv"), sep="\t", dtype=str)
covers = pd.read_csv(archive.open("COVERPAGE.tsv"), sep="\t", dtype=str)
filings = submissions.merge(covers, on="ACCESSION_NUMBER", how="left", validate="one_to_one")
labels = {"ACCESSION_NUMBER": "filing", "CIK": "cik", "FILINGMANAGER_NAME": "manager",
          "SUBMISSIONTYPE": "form", "PERIODOFREPORT": "report_date", "FILING_DATE": "filed"}
filings = filings.rename(columns=labels)[list(labels.values())]

labels = {"ACCESSION_NUMBER": "filing", "NAMEOFISSUER": "issuer", "TITLEOFCLASS": "share_class",
          "CUSIP": "cusip", "VALUE": "value_usd_m", "SSHPRNAMT": "shares_m",
          "SSHPRNAMTTYPE": "unit", "PUTCALL": "option"}
lines = pd.read_csv(archive.open("INFOTABLE.tsv"), sep="\t", usecols=list(labels), dtype=str)
lines[["VALUE", "SSHPRNAMT"]] = lines[["VALUE", "SSHPRNAMT"]].astype(float) / 1e6
lines = lines.rename(columns=labels)
print(len(filings), "filings,", len(lines), "lines")
print(filings["form"].value_counts().to_string())
11852 filings, 3830274 lines
form
13F-HR      9501
13F-NT      1946
13F-HR/A     399
13F-NT/A       6

In total, I get 11,852 reports: 9,501 list holdings (13F-HR), 1,946 notices (13F-NT), 399 amendments to a report that lists holdings (13F-HR/A), and 6 amendments to a notice (13F-NT/A). In the panel below, I exclude the amendments.

In each report, I keep the lines in shares (unit SH) for 30 June 2026 and exclude lines marked as options, as they are not needed to construct the panel data. I also combine a report’s lines with the same Committee on Uniform Securities Identification Procedures (CUSIP) number, because some lines show only part of a holding.

reports = filings[(filings["form"] == "13F-HR") & (filings["report_date"] == "30-JUN-2026")]
keep = lines["filing"].isin(reports["filing"]) & (lines["unit"] == "SH") & lines["option"].isna()
panel = (lines[keep].groupby(["filing", "cusip"], as_index=False)
         .agg(issuer=("issuer", "first"), share_class=("share_class", "first"),
              shares_m=("shares_m", "sum"), value_usd_m=("value_usd_m", "sum"))
         .merge(reports[["filing", "cik", "manager", "report_date", "filed"]], on="filing",
                validate="many_to_one"))
panel["report_date"] = pd.to_datetime(panel["report_date"], format="%d-%b-%Y")
panel["filed"] = pd.to_datetime(panel["filed"], format="%d-%b-%Y")
print(len(panel), "rows,", panel["cik"].nunique(), "managers,",
      panel["cusip"].nunique(), "securities")
columns = ["report_date", "filed", "cik", "manager", "issuer", "share_class", "shares_m",
           "value_usd_m"]
largest = panel[panel["cik"] == "0001067983"].nlargest(5, "value_usd_m")
print(largest[columns].round(1).to_string(index=False))
2407210 rows, 8846 managers, 25382 securities
report_date      filed        cik                manager              issuer  share_class  shares_m  value_usd_m
 2026-06-30 2026-08-14 0001067983 Berkshire Hathaway Inc           APPLE INC          COM     227.9      65950.3
 2026-06-30 2026-08-14 0001067983 Berkshire Hathaway Inc AMERICAN EXPRESS CO          COM     151.6      51282.3
 2026-06-30 2026-08-14 0001067983 Berkshire Hathaway Inc        COCA COLA CO          COM     400.0      32508.0
 2026-06-30 2026-08-14 0001067983 Berkshire Hathaway Inc        ALPHABET INC CAP STK CL A      78.8      28157.6
 2026-06-30 2026-08-14 0001067983 Berkshire Hathaway Inc   BANK OF AMER CORP          COM     483.4      27543.8
Column Meaning
report_date End of the quarter that the holdings refer to
filed Day the manager filed the report, when the holdings became public
cik, manager The SEC’s number for the manager, and its name
issuer, share_class The security
shares_m, value_usd_m Shares in millions, and their market value in millions of U.S. dollars at the end of the quarter

The panel contains 2,407,210 rows for 8,846 managers and 25,382 securities. The output shows Berkshire Hathaway’s five largest holdings.

Adding tickers

One issue is that 13F reports do not include the tickers of the manager’s holdings, which you would otherwise look up from the CUSIP number in each report. For this example, I use Bloomberg’s free OpenFIGI API. Numbers that start with a letter are CUSIP International Numbering System (CINS) numbers, which OpenFIGI looks up as ID_CINS.

holdings = panel[panel["cik"] == "0001067983"].sort_values("value_usd_m", ascending=False)
jobs = [{"idType": "ID_CINS" if cusip[0].isalpha() else "ID_CUSIP", "idValue": cusip,
         "exchCode": "US"} for cusip in holdings["cusip"]]
answers = []
for start in range(0, len(jobs), 10):
    response = requests.post("https://api.openfigi.com/v3/mapping", json=jobs[start:start + 10],
                             timeout=60)
    response.raise_for_status()
    answers += response.json()
tickers = [answer["data"][0]["ticker"] if "data" in answer else None for answer in answers]
holdings = holdings.assign(ticker=tickers)
print(len(holdings), "securities,", holdings["ticker"].isna().sum(), "without a ticker")
columns = ["report_date", "filed", "cik", "ticker", "issuer", "share_class", "shares_m",
           "value_usd_m"]
print(holdings[columns].head(10).round(1).to_string(index=False))
29 securities, 0 without a ticker
report_date      filed        cik ticker               issuer  share_class  shares_m  value_usd_m
 2026-06-30 2026-08-14 0001067983   AAPL            APPLE INC          COM     227.9      65950.3
 2026-06-30 2026-08-14 0001067983    AXP  AMERICAN EXPRESS CO          COM     151.6      51282.3
 2026-06-30 2026-08-14 0001067983     KO         COCA COLA CO          COM     400.0      32508.0
 2026-06-30 2026-08-14 0001067983  GOOGL         ALPHABET INC CAP STK CL A      78.8      28157.6
 2026-06-30 2026-08-14 0001067983    BAC    BANK OF AMER CORP          COM     483.4      27543.8
 2026-06-30 2026-08-14 0001067983    CVX  CHEVRON CORPORATION          COM      84.4      13986.1
 2026-06-30 2026-08-14 0001067983    OXY OCCIDENTAL PETE CORP          COM     264.9      12868.2
 2026-06-30 2026-08-14 0001067983     CB        CHUBB LIMITED          COM      34.2      11670.1
 2026-06-30 2026-08-14 0001067983    MCO          MOODYS CORP          COM      24.7      11173.4
 2026-06-30 2026-08-14 0001067983   GOOG         ALPHABET INC CAP STK CL C      27.2       9606.5

Berkshire’s 29 securities all get a current ticker from OpenFIGI.

Conclusion

In this post, I showed how to pull the SEC’s Form 13F data in Python and convert it into a panel of holdings. This data is convenient if you want to study changes in managers’ positions, quarter by quarter.

References

Division of Investment Management. (2026, March 6). Frequently asked questions about Form 13F. U.S. Securities and Exchange Commission. Retrieved November 24, 2026, from https://www.sec.gov/rules-regulations/staff-guidance/frequently-asked-questions-about-form-13f

OpenFIGI. (n.d.). Documentation [API documentation]. Retrieved November 24, 2026, from https://www.openfigi.com/api/documentation

U.S. Securities and Exchange Commission. (n.d.). Form 13F data sets [Documentation]. Retrieved November 24, 2026, from https://www.sec.gov/files/form_13f_readme.pdf

U.S. Securities and Exchange Commission. (2026). Form 13F data sets [Data set]. Retrieved November 24, 2026, from https://www.sec.gov/data-research/sec-markets-data/form-13f-data-sets